const mixin = {
  data(){
    return{
      search_form: {},
      fixed_form: {},
      list_data:{
        list: [],
        current: 0,
        size: 15,
        total: 1,
        loading: false,
        finished: false,
        refreshing: false,
      },
    }
  },
  methods:{
    getList(type){
      if(type == 'refresh'){  
        this.list_data.current = 1;
        this.list_data.list = [];
      }else{
        if(this.list_data.total > this.list_data.list.length){
          this.list_data.current ++;          
        }else{
          this.list_data.loading = false;
          this.list_data.fininshed = true;
          return;
        }
      }
      let params = Object.assign(this.search_form, this.fixed_form, {current: this.list_data.current, size: this.list_data.size})
      this.list_data.loading = true;
      this.$http('get', this.list_api, params, (data,msg) => {
        this.list_data.loading = false;
        this.list_data.finished = true;
        this.list_data.refreshing = false;
        this.list_data.list = data.records;
        this.list_data.total = data.total;
      }, msg => {
        this.list_data.current--;
        this.list_data.total = 1;
        this.list_data.loading = false;
        this.list_data.finished = true;
        this.list_data.refreshing = false;
      })
    }
  }
}
export default mixin